#include <stdio.h>
#include <string.h>

int main() {
	char arr[101] = {0};
	fgets(arr, 101, stdin);
	int len = strlen(arr);
	char nowword[16] = {0};
	int count = 0;
	int flag = 0 ;
	int i = 0;
	int j = 0;
	int k = 0;
	for (i = len - 1; i >= 0; i--) {
		if (arr[i] >= 'a' && arr[i] <= 'z' || arr[i] >= 'A' && arr[i] <= 'Z') {
			flag = 1;
		}
		while (flag == 1) {
			if (arr[i] == ' ') {
				for (j = count - 1; j >= 0; j--) {
					printf("%c", nowword[j]);
				}

				printf(" ");
				i++;
				break;
			}

			nowword[count++] = arr[i];
			if (i == 0) {
				for (j = count - 1; j >= 0; j--) {
					printf("%c", nowword[j]);
				}
				break;
			}
			i--;
		}
		count = 0;
		flag = 0;
		for (k = 0; nowword[k]; k++) {
			nowword[k] = 0;
		}


	}



	return 0;
}